﻿@model AutomatedTestDataManagement.Models.TestTestStep

@if(ViewData["DeleteFrom"] == null)
{
                  <tr>
                       <td>
                           @if(ViewData["Delete"] == null)
                           {
                                @Html.EditorFor(modelItem => modelItem.TestStep.StepDescription)
                           }
                           else
                           {
                               @Html.DisplayFor(modelItem => modelItem.TestStep.StepDescription)
                           }
                       </td>
                       <td>
                           @Html.DisplayFor(modelItem => modelItem.TestStep.StepKind.StepKind1)
                       </td>
                       <td>
                           @Html.DisplayFor(modelItem => modelItem.TestStep.DataID) @Html.DisplayFor(modelItem => modelItem.TestStep.StepKind.DataTable)
                       </td>
                      <td>
                          @Html.HiddenFor(modelItem => modelItem.TestTestStepID)
                          @Html.HiddenFor(modelItem => modelItem.TestID)
                          @Html.HiddenFor(modelItem => modelItem.TestStepID)
                          @if(ViewData["Delete"] == null)
                          {
                            @Html.EditorFor(modelItem => modelItem.StepNumber)
                          }
                          else
                          {
                              @Html.DisplayFor(modelItem => modelItem.StepNumber)
                          }
                          @Html.HiddenFor(modelItem => modelItem.TestStep.StepDescription)
                          @Html.HiddenFor(modelItem => modelItem.TestStep.StepKindID)
                          @Html.HiddenFor(modelItem => modelItem.TestStep.DataID)
                          @Html.HiddenFor(modelItem => modelItem.TestStep.StepKind.StepKind1)
                          @Html.HiddenFor(modelItem => modelItem.TestStep.StepKind.StepDescription)
                          @Html.HiddenFor(modelItem => modelItem.TestStep.StepKind.IsNavi)
                          @Html.HiddenFor(modelItem => modelItem.TestStep.StepKind.DataTable)
                          @Html.HiddenFor(modelItem => modelItem.TestStep.TestStepID)
                          @Html.HiddenFor(modelItem => modelItem.TestStep.StepKind.StepKindID)
                      </td>
                       <td>
                           @if(ViewData["TestScenarioID"] == null)
                           {
                               if(ViewData["Delete"] == null)
                               { 
                                    @Html.ActionLink("Edit Step", "Edit", "TestStep", new {id = Model.TestStepID, testID = Model.TestID }, null) @Html.Encode(" | ")
                                    @Html.ActionLink("Remove Step", "Delete", "TestTestStep", new { id = Model.TestTestStepID, testID = Model.TestID, returnToView = "Edit" }, null)
                               }
                               else
                               {
                                    @Html.ActionLink("Remove Step", "Delete", "TestTestStep", new { id = Model.TestTestStepID, testID = Model.TestID, returnToView = "Delete" }, null)
                                }
                           }
                           else
                           {
                               if (ViewData["SuiteID"] == null)
                               {
                                   if(ViewData["Delete"] == null)
                                   {
                                        @Html.ActionLink("Edit Step", "Edit", "TestStep", new{id = Model.TestStepID, testID = Model.TestID, scenarioID = ViewData["TestScenarioID"]}, null) @Html.Encode(" | ")
                                        @Html.ActionLink("Remove Step", "Delete", "TestTestStep", new { id = Model.TestTestStepID, testID = Model.TestID, scenarioID = ViewData["TestScenarioID"], returnToView = "Edit" }, null)
                                    }
                                    else
                                    {
                                        @Html.ActionLink("Remove Step", "Delete", "TestTestStep", new { id = Model.TestTestStepID, testID = Model.TestID, scenarioID = ViewData["TestScenarioID"], returnToView = "Delete" }, null)
                                    }
                               }
                               else 
                               {
                                   if(ViewData["Delete"] == null)
                                   {
                                        @Html.ActionLink("Edit Step", "Edit", "TestStep", new{id = Model.TestStepID, testID = Model.TestID, scenarioID = ViewData["TestScenarioID"], suiteID = ViewData["SuiteID"] }, null) @Html.Encode(" | ")
                                        @Html.ActionLink("Remove Step", "Delete", "TestTestStep", new { id = Model.TestTestStepID, testID = Model.TestID, scenarioID = ViewData["TestScenarioID"], suiteID = ViewData["SuiteID"], returnToView = "Edit" }, null)
                                    }
                                   else
                                   {
                                        @Html.ActionLink("Remove Step", "Delete", "TestTestStep", new { id = Model.TestTestStepID, testID = Model.TestID, scenarioID = ViewData["TestScenarioID"], suiteID = ViewData["SuiteID"], returnToView = "Delete" }, null)
                                   }
                               }
                           }
                       </td>
                   </tr>
}
else
{
    <tr>
        <td>
            @Html.DisplayFor(m => m.Test.TestName)
        </td>
        <td>
            @Html.DisplayFor(m => m.Test.TestDescription)
        </td>
        <td>
            @Html.ActionLink("Remove Test Step from this Test", "Delete", "TestTestStep", new { id = Model.TestTestStepID, testStepID = Model.TestStepID, returnToView = "Delete"}, null)
        </td>
    </tr>
}
